/**
 * Created by LeungZ on 2016/3/11.
 */
import './styles/_styles.scss';
import components from './src/components/_components.js'
import services from './src/services/_services.js';

angular.module('ctg-k8sconsole', ['ui.router', 'pasp.ui', 'ui.chart', services, components])
    .constant('uibPaginationConfig', {
        firstText: '<<',
        previousText: '<',
        nextText: '>',
        lastText: '>>',
        boundaryLinks: true,
        directionLinks: true,
        maxSize: 5
    })
    .config(['$urlRouterProvider', function ($urlRouterProvider) {
        $urlRouterProvider.otherwise("/welcome")
    }])
    .run(['userSrv', '$rootScope', 'uiNotification', function (userSrv, $rootScope, uiNotification) {
        userSrv.getUserInfo().then(data=> {
            $rootScope.user = data.user;
        }).catch(function (data) {
            uiNotification.error({
                title: '用户信息',
                message: '获取用户信息数据有误'
            });
        })
    }]);

let configs = require.context("./src/pages", true, /.route.js$/);
configs.keys().forEach(key => {
    configs(key);
});